package cn.jiyun.function.config;

import cn.jiyun.function.mapper.DemandMapper;
import cn.jiyun.function.service.DemandService;
import com.github.houbb.sensitive.word.api.IWordDeny;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Component
@Slf4j
@RestController
@RequestMapping("sensitive")
public class CustomWordDeny implements IWordDeny {

   @Autowired
   private  DemandService demandService;

    public CustomWordDeny(DemandService demandService) {
        this.demandService = demandService;
    }


    @Override
    @PostConstruct
    @RequestMapping("words")
    public List<String> deny() {
        log.info("222222222222222222222222222222222CustomWordDeny init");
        List<String> all = demandService.findAll1();
        log.info("2222222222222222222222222CustomWordDeny deny:{}", all);
        return all;
    }

}
